import uuid
from typing import Any

import pytest

from recruit.domain.models.resume_position import (
    BaseResumePosition,
    ResumePositionCreate,
    ResumePositionResult,
    ResumePositionUpdate,
)
from .utils import check_attr_model, check_json_schema


@pytest.mark.parametrize(
    'data, keys', [(
            {
                'position': 'Position',
                'employment': 'Employment',
                'work_schedule': 'work schedule'
            },
            ('position', 'employment', 'workSchedule')
    )]
)
def test_resume_position_base(
        data: dict[str, str],
        keys: tuple[str, ...]
) -> None:
    check_attr_model(BaseResumePosition, data)
    check_json_schema(BaseResumePosition, keys)


@pytest.mark.parametrize(
    'data, keys', [(
            {
                'position': 'Position',
                'employment': 'Employment',
                'work_schedule': 'work schedule'
            },
            ('position', 'employment', 'workSchedule')
    )]
)
def test_resume_position_create(
        data: dict[str, str],
        keys: tuple[str, ...]
) -> None:
    check_attr_model(ResumePositionCreate, data)
    check_json_schema(ResumePositionCreate, keys)


@pytest.mark.parametrize(
    'data, keys', [(
            {
                'id': uuid.uuid4(),
                'position': 'Position',
                'employment': 'Employment',
                'work_schedule': 'work schedule'
            },
            ('id', 'position', 'employment', 'workSchedule')
    )]
)
def test_resume_position_result(
        data: dict[str, Any],
        keys: tuple[str, ...]
) -> None:
    check_attr_model(ResumePositionResult, data)
    check_json_schema(ResumePositionResult, keys)


@pytest.mark.parametrize(
    'data, keys', [(
            {
                'position': 'Position',
                'employment': 'Employment',
                'work_schedule': 'work schedule'
            },
            ('position', 'employment', 'workSchedule')
    )]
)
def test_resume_position_update(
        data: dict[str, str],
        keys: tuple[str, ...]
) -> None:
    check_attr_model(ResumePositionUpdate, data)
    check_json_schema(ResumePositionUpdate, keys)
    check_attr_model(ResumePositionUpdate, {}, tuple(data))
    check_json_schema(ResumePositionUpdate, keys)
